<include file="common/header_lixin" title="我的团队" />
<div class="page">
  <div class="page-hd">
    <div class="header bor-1px-b">
    <div class="header-left">
        <a href="javascript:history.go(-1)" class="left-arrow"></a>
    </div>
    <div class="header-title">我的团队</div>
    <div class="header-right">
        <a href="#"></a>
    </div>
</div>
  </div>

  <div class="page-bd">
    <!-- 页面内容-->
    <div class="income_table mt30">
      <table width="100%" id="tab2">

      </table>
    </div>
    <include file="common/footer_lixin"/>
  </div>
</div>

<script>
    $(function() {
        FastClick.attach(document.body);
    });
</script>
<script>
    var ajax_status = false;
    var p = 1;
    init();
      //验证表单
    function loadlist(){
        $.ajax({
            url : "/index.php/Acc/Member/team/p/"+p,
            type:'post',
            dataType:'json',
            data:{'p':p},
            success:function(data){
               if($.trim(data)==''){
                    $.toast.prototype.defaults.duration=1200;
                    $.toast("无团队信息", "text");
                }else{
                    ajax_status = false;
                    if(p == 1){
                      $('#tab2').prepend('<tr>\n' +
                              '    <td>总合约数：' + '{$teamCount}' + '</td>\n' +
                              '    <td>业绩: ' + '{$receiveCount}' + '</td>\n' +
                              '</tr>');
                    }
                 $('#tab2').append(data);
                }
            },
            error:function(){
                $.toptip('网络异常，请稍后再试', 'error');
            }
        })
    }

    function init(){
      if (ajax_status) return;
        ajax_status = true;
        $('.weui-loadmore').show();
        loadlist();
    }

    // 加载更多商品
    $('.page-bd').infinite(30).on("infinite", function() {
        if (ajax_status) return;
        ajax_status = true;
        $('.weui-loadmore').show();
        setTimeout(function () {
            p++;
            loadlist();
        }, 1500);   //模拟延迟
    });
</script>
</body>
</html>
